package com.ruoyi.cqjd.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cqjd.mapper.CqjdOrderDetailMapper;
import com.ruoyi.cqjd.domain.CqjdOrderDetail;
import com.ruoyi.cqjd.service.ICqjdOrderDetailService;

/**
 * 订单明细Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-06-19
 */
@Service
public class CqjdOrderDetailServiceImpl implements ICqjdOrderDetailService 
{
    @Autowired
    private CqjdOrderDetailMapper cqjdOrderDetailMapper;

    /**
     * 查询订单明细
     * 
     * @param id 订单明细主键
     * @return 订单明细
     */
    @Override
    public CqjdOrderDetail selectCqjdOrderDetailById(Long id)
    {
        return cqjdOrderDetailMapper.selectCqjdOrderDetailById(id);
    }

    /**
     * 查询订单明细列表
     * 
     * @param cqjdOrderDetail 订单明细
     * @return 订单明细
     */
    @Override
    public List<CqjdOrderDetail> selectCqjdOrderDetailList(CqjdOrderDetail cqjdOrderDetail)
    {
        return cqjdOrderDetailMapper.selectCqjdOrderDetailList(cqjdOrderDetail);
    }

    /**
     * 新增订单明细
     * 
     * @param cqjdOrderDetail 订单明细
     * @return 结果
     */
    @Override
    public int insertCqjdOrderDetail(CqjdOrderDetail cqjdOrderDetail)
    {
        return cqjdOrderDetailMapper.insertCqjdOrderDetail(cqjdOrderDetail);
    }

    /**
     * 修改订单明细
     * 
     * @param cqjdOrderDetail 订单明细
     * @return 结果
     */
    @Override
    public int updateCqjdOrderDetail(CqjdOrderDetail cqjdOrderDetail)
    {
        return cqjdOrderDetailMapper.updateCqjdOrderDetail(cqjdOrderDetail);
    }

    /**
     * 批量删除订单明细
     * 
     * @param ids 需要删除的订单明细主键
     * @return 结果
     */
    @Override
    public int deleteCqjdOrderDetailByIds(Long[] ids)
    {
        return cqjdOrderDetailMapper.deleteCqjdOrderDetailByIds(ids);
    }

    /**
     * 删除订单明细信息
     * 
     * @param id 订单明细主键
     * @return 结果
     */
    @Override
    public int deleteCqjdOrderDetailById(Long id)
    {
        return cqjdOrderDetailMapper.deleteCqjdOrderDetailById(id);
    }

    @Override
    public void saveBatch(List<CqjdOrderDetail> orderDetails) {
        for (CqjdOrderDetail orderDetail : orderDetails) {
            cqjdOrderDetailMapper.insertCqjdOrderDetail(orderDetail);
        }
    }

    @Override
    public List<CqjdOrderDetail> getOrderDetailListByOrderId(Long orderId) {
        return cqjdOrderDetailMapper.getOrderDetailListByOrderId(orderId);

    }
}
